/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bs.stock.modelo;

import bs.global.modelo.Auditoria;
import bs.global.modelo.Moneda;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ctrosch
 */
@Entity
@Table(name = "st_movimiento_item")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TIPITM", discriminatorType = DiscriminatorType.STRING, length = 10)
public abstract class ItemMovimientoStock implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)   
    @Column(name = "ID", nullable = false)
    private Integer id;
    
    @Column(name = "NROITM", nullable = false)
    private int nroitm;    
    
    @Column(name = "SUCURS", nullable = false, length = 6)
    private String sucurs;
            
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ID_MCAB", referencedColumnName = "ID", nullable = false)        
    private MovimientoStock movimiento;
    
    @Column(name = "NIVEXP", nullable = false, length = 2)
    private String nivexp;
    
    @Column(name = "DEPOSI", nullable = false, length = 15)
    private String deposi;
    
    @Column(name = "SECTOR", nullable = false, length = 15)
    private String sector;
    
    @Column(name = "NSERIE", nullable = false, length = 30)
    private String nserie;
    
    @Column(name = "NDESPA", nullable = false, length = 30)
    private String ndespa;
    
    @Column(name = "ENVASE", nullable = false, length = 30)
    private String envase;
    
    @Column(name = "NOTROS", nullable = false, length = 30)
    private String notros;

    @Column(name = "FCHMOV")
    @Temporal(TemporalType.DATE)
    private Date fchmov;
    
    @JoinColumn(name = "ARTCOD", referencedColumnName = "CODIGO", nullable = false)    
    @ManyToOne(fetch = FetchType.LAZY)
    private Producto producto;

    @Column(name = "NFECHA", length = 30)
    private String nfecha;
    @Column(name = "NATRIB", length = 30)
    private String natrib;
    @Column(name = "NUBICA", length = 30)
    private String nubica;
    @Column(name = "NESTAN", length = 30)
    private String nestan;

    @Column(name = "TSERIE", length = 30)
    private String tserie;
    @Column(name = "TDESPA", length = 30)
    private String tdespa;
    @Column(name = "TENVAS", length = 30)
    private String tenvas;
    @Column(name = "TOTROS", length = 30)
    private String totros;
    @Column(name = "TFECHA", length = 30)
    private String tfecha;
    @Column(name = "TATRIB", length = 30)
    private String tatrib;
    @Column(name = "TUBICA", length = 30)
    private String tubica;
    @Column(name = "TESTAN", length = 30)
    private String testan;

    @Column(name = "CANTID", precision = 15, scale = 4)
    private BigDecimal cantidad;
    @Column(name = "CNTSEC", precision = 15, scale = 4)
    private BigDecimal cantidadSecundaria;
    
    @Column(name = "STOCKS", precision = 15, scale = 4)
    private BigDecimal stocks;
    
    @Column(name = "PRECIO", precision = 15, scale = 4)
    private BigDecimal precio;
    @Column(name = "PRESEC", precision = 15, scale = 4)
    private BigDecimal precioSecundario;
        
    @JoinColumn(name = "COFLIS", referencedColumnName = "CODIGO")
    @ManyToOne(fetch = FetchType.LAZY)
    private Moneda monedaListaPrecio;
    
    @Column(name = "COTIZA", precision = 15, scale = 4)
    private BigDecimal cotizacion;
    
    /**
     * Observaciones
     */
    @Lob
    @Column(name = "OBSERV", length = 65535)
    private String observaciones;
    
    @Column(name = "TIPOPR", length = 6)
    private String tipopr;
    @Column(name = "CODOPR", length = 30)
    private String codopr;
    
    @Embedded
    private Auditoria auditoria;


    public ItemMovimientoStock() {
    }

    public ItemMovimientoStock(String sucurs, int nroitm, String nivexp, String deposi, String sector, String nserie, String ndespa, String notros) {
        
        this.sucurs = sucurs;
        this.nroitm = nroitm;        
        this.nivexp = nivexp;
        this.deposi = deposi;
        this.sector = sector;
        this.nserie = nserie;
        this.ndespa = ndespa;
        this.notros = notros;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getNroitm() {
        return nroitm;
    }

    public void setNroitm(int nroitm) {
        this.nroitm = nroitm;
    }

    public String getSucurs() {
        return sucurs;
    }

    public void setSucurs(String sucurs) {
        this.sucurs = sucurs;
    }

    public MovimientoStock getMovimiento() {
        return movimiento;
    }

    public void setMovimiento(MovimientoStock movimiento) {
        this.movimiento = movimiento;
    }

    public String getNivexp() {
        return nivexp;
    }

    public void setNivexp(String nivexp) {
        this.nivexp = nivexp;
    }

    public String getDeposi() {
        return deposi;
    }

    public void setDeposi(String deposi) {
        this.deposi = deposi;
    }

    public String getSector() {
        return sector;
    }

    public void setSector(String sector) {
        this.sector = sector;
    }

    public String getNserie() {
        return nserie;
    }

    public void setNserie(String nserie) {
        this.nserie = nserie;
    }

    public String getNdespa() {
        return ndespa;
    }

    public void setNdespa(String ndespa) {
        this.ndespa = ndespa;
    }

    public String getEnvase() {
        return envase;
    }

    public void setEnvase(String envase) {
        this.envase = envase;
    }

    public String getNotros() {
        return notros;
    }

    public void setNotros(String notros) {
        this.notros = notros;
    }

    public Date getFchmov() {
        return fchmov;
    }

    public void setFchmov(Date fchmov) {
        this.fchmov = fchmov;
    }

    public Producto getProducto() {
        return producto;
    }

    public void setProducto(Producto producto) {
        this.producto = producto;
    }

    public String getNfecha() {
        return nfecha;
    }

    public void setNfecha(String nfecha) {
        this.nfecha = nfecha;
    }

    public String getNatrib() {
        return natrib;
    }

    public void setNatrib(String natrib) {
        this.natrib = natrib;
    }

    public String getNubica() {
        return nubica;
    }

    public void setNubica(String nubica) {
        this.nubica = nubica;
    }

    public String getNestan() {
        return nestan;
    }

    public void setNestan(String nestan) {
        this.nestan = nestan;
    }

    public String getTserie() {
        return tserie;
    }

    public void setTserie(String tserie) {
        this.tserie = tserie;
    }

    public String getTdespa() {
        return tdespa;
    }

    public void setTdespa(String tdespa) {
        this.tdespa = tdespa;
    }

    public String getTenvas() {
        return tenvas;
    }

    public void setTenvas(String tenvas) {
        this.tenvas = tenvas;
    }

    public String getTotros() {
        return totros;
    }

    public void setTotros(String totros) {
        this.totros = totros;
    }

    public String getTfecha() {
        return tfecha;
    }

    public void setTfecha(String tfecha) {
        this.tfecha = tfecha;
    }

    public String getTatrib() {
        return tatrib;
    }

    public void setTatrib(String tatrib) {
        this.tatrib = tatrib;
    }

    public String getTubica() {
        return tubica;
    }

    public void setTubica(String tubica) {
        this.tubica = tubica;
    }

    public String getTestan() {
        return testan;
    }

    public void setTestan(String testan) {
        this.testan = testan;
    }

    public BigDecimal getCantidad() {
        return cantidad;
    }

    public void setCantidad(BigDecimal cantidad) {
        this.cantidad = cantidad;
    }

    public BigDecimal getCantidadSecundaria() {
        return cantidadSecundaria;
    }

    public void setCantidadSecundaria(BigDecimal cantidadSecundaria) {
        this.cantidadSecundaria = cantidadSecundaria;
    }

    public BigDecimal getStocks() {
        return stocks;
    }

    public void setStocks(BigDecimal stocks) {
        this.stocks = stocks;
    }

    public BigDecimal getPrecio() {
        return precio;
    }

    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }

    public BigDecimal getPrecioSecundario() {
        return precioSecundario;
    }

    public void setPrecioSecundario(BigDecimal precioSecundario) {
        this.precioSecundario = precioSecundario;
    }

    public Moneda getMonedaListaPrecio() {
        return monedaListaPrecio;
    }

    public void setMonedaListaPrecio(Moneda monedaListaPrecio) {
        this.monedaListaPrecio = monedaListaPrecio;
    }

    public BigDecimal getCotizacion() {
        return cotizacion;
    }

    public void setCotizacion(BigDecimal cotizacion) {
        this.cotizacion = cotizacion;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public String getTipopr() {
        return tipopr;
    }

    public void setTipopr(String tipopr) {
        this.tipopr = tipopr;
    }

    public String getCodopr() {
        return codopr;
    }

    public void setCodopr(String codopr) {
        this.codopr = codopr;
    }

    public Auditoria getAuditoria() {
        return auditoria;
    }

    public void setAuditoria(Auditoria auditoria) {
        this.auditoria = auditoria;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ItemMovimientoStock other = (ItemMovimientoStock) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ItemMovimientoStock{" + "id=" + id + '}';
    }
    
}
